import syscall

var (_, err) = try syscall.open('mock/notfound.txt', syscall.O_RDONLY, 0666)
if err.has {
    print('open mock/notfound.txt failed: ', err.msg, '\n')
} else {
    println('open mock/notfound.txt successful')
}

var (fd, err) = try syscall.open('mock/open.txt', syscall.O_RDONLY | syscall.O_CREAT, 0666)
if err.has {
    print('open mock/open.txt failed: ', err.msg, '\n')
} else {
    println('open mock/open.txt successful')
}

// read buf is [u8]
var buf = vec<u8>{len=20}
var (len, err) = try syscall.read(fd, buf)
if err.has {
    return print(err.msg)
}

print('actual read len: ', len, '\n')
var str =  buf as string
print('buf as string: ', str, '\n')